package com.king.juc.shared.safe;

import java.util.ArrayList;
import java.util.List;

/**
 * @author king
 * @date 2020/10/28 15:48
 */
public class ThreadUnSafe {
    List<String> list = new ArrayList<>();

    public void method1(int loopNumber){
        for (int i = 0; i < loopNumber; i++) {
            method2();
            method3();
        }
    }

    private void method3() {
        list.remove(0);
    }

    private void method2() {
        list.add("1");
    }
}
